import 'layui-src';
layui.config({
    dir: '/dist/'
})
import 'layui-src/src/css/layui.css';
import $ from "../jquery-3.4.1.min.js";
import "../../css/login.css";


$("#login").click(function (e) {
    const username = $("[name=username]").val();
    const password = $("[name=password]").val();
    e.preventDefault();
    $.ajax({
        url: "http://192.168.13.6:8000/PropertyUser/login",
        type: "post",
        data: { username, password },
        success(res) {
            if (res.code) {
                localStorage.token = res.token;
                alert(res.message);
                location.href = "list.html"
            } else {
                alert(res.message);
            }
        },
        error(res) {
            console.log(res)
        }
    })
})